#!/bin/sh
# srcbootldr0
set -x
# load boot loader, SCA0 1434 channels 1 and 2
# strapped to boot from host port

# x:0x00100020 is location of the ICR of the 56002 host port.
# x:0x0010003c is location of the LSB of the 56002 host port.
# hwblkio writes bytes in sequence to y addresses:
#	223c - 2*4  = 2234
#	223c - 1*4  = 2238
#	223c - 0*4  = 223c
############################################ monload
BINFILE=monload.bin

# transfer data
hwblkio -W -b 3 -B 4 -s 32 -x -@0x0010003c -f $BINFILE
sleep 1

# set bit 3 of ICR, host flag 0, HF0, to terminate load and start loader
hwblkio -W -b 1 -B 1 -x -@0x00100020 -V 0x00000008
sleep 1

# clear bit 3 of ICR, host flag 0 to start command mode of loader
hwblkio -W -b 1 -B 1 -x -@0x00100020 -V 0x00000000
sleep 1

